See Original text in context
multi sub trait_mod:<is>(Routine , :!)
Marks a Routine
as deprecated; that is, it should no longer be used going forward, and will eventually be removed. An optional message specifying the replacement functionality can be specified
By having both the original (deprecated) and new Routine
available simultaneously, you can avoid a breaking change in a single release, by allowing users time and instructions on how to update their code. Remove the deprecated version only after at least one release that includes both the warning and the new Routine
.
This code
sub f() is DEPRECATED('the literal 42')say f();
produces this output:
42Saw 1 occurrence of deprecated code.================================================================================Sub f (from GLOBAL) seen at:deprecated.p6, line 2Please use the literal 42 instead.--------------------------------------------------------------------------------Please contact the author to have these occurrences of deprecated codeadapted, so that this message will disappear!
See Original text in context
multi sub trait_mod:<is>(Attribute , :!)
Marks an attribute as deprecated, optionally with a message what to use instead.
my = C.new( foo => 42 ); # doesn't trigger with initialization (yet)say .foo; # does trigger on usage
After the program is finished, this will show something like this on STDERR:
# Saw 1 occurrence of deprecated code.# =====================================# Method foo (from C) seen at:# script.p6, line 5# Please use 'bar' instead.